import { createApp } from 'vue'
import { setupAssets, setupThirdLibs } from '@/plugins'
import App from './App.vue'
import 'jsoneditor'
import AppLoading from './components/_builtin/app-loading/index.vue'
import { setupDirectives } from './directives'
import { setupRouter } from './router'
import { setupStore } from './store'
import { setupI18n } from './locales'
import VxeUITable from 'vxe-table'
import 'vxe-table/lib/style.css'

async function setupApp() {
    // import assets: js、css
    setupAssets()

    // app loading
    const appLoading = createApp(AppLoading)

    appLoading.mount('#appLoading')

    const app = createApp(App)
    // createApp(App).use(VxeUITable).mount('#app')


    setupThirdLibs(app)
    // store plugin: pinia
    setupStore(app)

    // vue custom directives
    setupDirectives(app)

    // vue router
    await setupRouter(app)

    setupI18n(app)

    appLoading.unmount()

    // mount app
    app.mount('#app')
}

setupApp()
